#include<bits/stdc++.h>
using namespace std;
int n,q,x,y,z,a[8001],b[8001];
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	while(q>0){
		q--;
		scanf("%d%d",&z,&x);
		if(z==1){
			scanf("%d",&y);
			a[x]=y;
		}
		else{
			int s=1;
			for(int i=1;i<x;i++){
				if(a[i]==a[x])s++;
			}
			for(int i=1;i<=n;i++){
				if(a[i]<a[x])s++;
			}
			printf("%d\n",s);
		}
	}
	fclose(stdin);
	fclose(stdout);
}
